classDiagram
    class User {
        uid: string <<用户唯一标识>>
        username: string <<用户名>>
        email: email <<邮箱>>
        phone: phone <<手机号>>
        avatar: x-image <<头像>>
        nickname: string <<昵称>>
        gender: x-enum = "unknown" <<性别>>
        birthday: date <<生日>>
        status: x-enum = "active" <<用户状态>>
        role: x-enum = "user" <<用户角色>>
        createTime: datetime <<创建时间>>
        updateTime: datetime <<更新时间>>
        lastLoginTime: datetime <<最后登录时间>>
        isEmailVerified: boolean = false <<邮箱是否验证>>
        isPhoneVerified: boolean = false <<手机是否验证>>
        profile: UserProfile <<用户档案>>
        permissions: string[] <<权限列表>>
        required() ["uid", "username", "email"]
        unique() ["uid", "username", "email"]
        enum_gender() ["unknown", "male", "female"]
        enum_status() ["active", "inactive", "banned", "pending"]
        enum_role() ["user", "admin", "moderator", "vip"]
        display_field() "username"
    }
    
    class UserProfile {
        realName: string <<真实姓名>>
        idCard: string <<身份证号>>
        address: string <<地址>>
        bio: x-rtf <<个人简介>>
        company: string <<公司>>
        jobTitle: string <<职位>>
        website: url <<个人网站>>
        socialLinks: object <<社交链接>>
        preferences: object <<用户偏好设置>>
        display_field() "realName"
    }
    
    class UserLoginLog {
        userId: string <<用户ID>>
        loginTime: datetime <<登录时间>>
        loginIp: string <<登录IP>>
        loginDevice: string <<登录设备>>
        loginLocation: string <<登录地点>>
        userAgent: string <<用户代理>>
        loginType: x-enum <<登录类型>>
        display_field() "loginTime"
        enum_loginType() ["password", "wechat", "anonymous", "phone", "email"]
    }
    
    %% 关联关系
    User "1" --> "1" UserProfile : profile
    User "1" --> "n" UserLoginLog : loginLogs
    
    %% 类的命名
    note for User "用户模型"
    note for UserProfile "用户档案模型"
    note for UserLoginLog "用户登录日志模型"